import 'package:fluro_decorate/fluro_decorate.dart';
import 'package:fluro_decorate/src/bundle.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

///
/// @ProjectName:    fluro_decorate
/// @Package:
/// @ClassName:      demo
/// @Description:    dart文件作用
/// @Author:         WTT
/// @CreateDate:     2021/10/27 5:23 下午
class Demo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        body: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text("Demo"),
            Container(
              child: TextButton(
                  child: Text("返回"),
                  onPressed: () {
                    Bundle bundle = Bundle();
                    bundle.putBool("bool", true);
                    bundle.putInt("int", 123);
                    bundle.putString("string", 'test');
                    NavigatorUtil.pop(context, bundle: bundle);
                  }),
            ),
            Container(
              child: TextButton(
                  child: Text("回到首页"),
                  onPressed: () {
                    Bundle bundle = Bundle();
                    bundle.putBool("bool", true);
                    bundle.putInt("int", 1000);
                    bundle.putString(
                        "string", '回到首页${DateTime.now().toString()}');
                    bundle.putMap("map", {"abc": "value01"});
                    NavigatorUtil.clearStackAndToRoute(context, "/",
                        bundle: bundle);
                  }),
            ),
            Container(
              child: TextButton(
                  child: Text("返回指定页面"),
                  onPressed: () {
                    NavigatorUtil.toLastRoute(context);
                  }),
            ),
          ],
        ),
      ),
    );
  }
}
